#include "fallback-c89.c"
-static gboolean
-render_icon_image (GtkStyleContext *context,
- cairo_t *cr,
- double x,
- double y,
- double width,
- double height)
+static void
+render_icon_image (GtkStyleContext *context,
+ cairo_t *cr,
+ double x,
+ double y,
+ double width,
+ double height,
+ GtkCssImageBuiltinType builtin_type)
{
const GtkCssValue *shadows;
cairo_matrix_t matrix, transform_matrix;
image = _gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE));
if (image == NULL)
- return TRUE;
-
- if (GTK_IS_CSS_IMAGE_BUILTIN (image))
- return FALSE;
+ return;
shadows = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SHADOW);
if (_gtk_css_shadows_value_is_none (shadows))
{
cairo_transform (cr, &matrix);
- _gtk_css_image_draw (image, cr, width, height);
+ gtk_css_image_builtin_draw (image, cr, width, height, builtin_type);
}
else
{
cairo_push_group (cr);
cairo_transform (cr, &matrix);
- _gtk_css_image_draw (image, cr, width, height);
+ gtk_css_image_builtin_draw (image, cr, width, height, builtin_type);
cairo_pop_group_to_source (cr);
_gtk_css_shadows_value_paint_icon (shadows, cr);
cairo_paint (cr);
}
}
-
- return TRUE;
}
static void
else
image_type = GTK_CSS_IMAGE_BUILTIN_CHECK;
- if (render_icon_image (context, cr, x, y, width, height))
- return;
-
- cairo_translate (cr, x, y);
-
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- width, height,
- image_type);
+ render_icon_image (context, cr, x, y, width, height, image_type);
}
/**
else
image_type = GTK_CSS_IMAGE_BUILTIN_OPTION;
- if (render_icon_image (context, cr, x, y, width, height))
- return;
-
- cairo_translate (cr, x, y);
-
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- width, height,
- image_type);
+ render_icon_image (context, cr, x, y, width, height, image_type);
}
/**
break;
}
- if (render_icon_image (context, cr, x, y, size, size))
- return;
-
- cairo_translate (cr, x, y);
-
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- size, size,
- image_type);
+ render_icon_image (context, cr, x, y, size, size, image_type);
}
/**
: GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT;
}
- if (render_icon_image (context, cr, x, y, width, height))
- return;
-
- cairo_translate (cr, x, y);
-
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- width, height,
- image_type);
+ render_icon_image (context, cr, x, y, width, height, image_type);
}
/**
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
- if (render_icon_image (context, cr, x, y, width, height))
- return;
-
- cairo_translate (cr, x, y);
-
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_GRIP))
{
GtkJunctionSides sides = gtk_style_context_get_junction_sides (context);
type = GTK_CSS_IMAGE_BUILTIN_HANDLE;
}
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- width, height,
- type);
+ render_icon_image (context, cr, x, y, width, height, type);
}
/**
cairo_restore (cr);
}
-static void
-gtk_do_render_activity (GtkStyleContext *context,
- cairo_t *cr,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height)
-{
- if (render_icon_image (context, cr, x, y, width, height))
- return;
-
- cairo_translate (cr, x, y);
-
- gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)),
- cr,
- width, height,
- GTK_CSS_IMAGE_BUILTIN_SPINNER);
-}
-
/**
* gtk_render_activity:
* @context: a #GtkStyleContext
cairo_save (cr);
cairo_new_path (cr);
- gtk_do_render_activity (context, cr, x, y, width, height);
+ render_icon_image (context, cr, x, y, width, height, GTK_CSS_IMAGE_BUILTIN_SPINNER);
cairo_restore (cr);
}